|
|
@@ -175,7 +175,7 @@ class AgentsController < ApplicationController
|
175
|
175
|
|
176
|
176
|
respond_to do |format|
|
177
|
177
|
if @agent.update_attributes(params[:agent])
|
178
|
|
- format.html { redirect_back "'#{@agent.name}' was successfully updated." }
|
|
178
|
+ format.html { redirect_back "'#{@agent.name}' was successfully updated.", return: agents_path }
|
179
|
179
|
format.json { render json: @agent, status: :ok, location: agent_path(@agent) }
|
180
|
180
|
else
|
181
|
181
|
initialize_presenter
|
|
|
@@ -225,13 +225,13 @@ class AgentsController < ApplicationController
|
225
|
225
|
protected
|
226
|
226
|
|
227
|
227
|
# Sanitize params[:return] to prevent open redirect attacks, a common security issue.
|
228
|
|
- def redirect_back(message)
|
229
|
|
- case ret = params[:return]
|
|
228
|
+ def redirect_back(message, options = {})
|
|
229
|
+ case ret = params[:return] || options[:return]
|
230
|
230
|
when "show"
|
231
|
231
|
if @agent && !@agent.destroyed?
|
232
|
232
|
path = agent_path(@agent)
|
233
|
233
|
end
|
234
|
|
- when /\A#{Regexp::escape scenarios_path}\/\d+\Z/
|
|
234
|
+ when /\A#{Regexp::escape scenarios_path}\/\d+\Z/, agents_path
|
235
|
235
|
path = ret
|
236
|
236
|
end
|
237
|
237
|
|